package com.sali.design_pattern.d_strategy_pattern.lesson_03;

import com.sali.design_pattern.d_strategy_pattern.lesson_03.strategy.IMyOperatorStrategy;
import com.sali.design_pattern.d_strategy_pattern.lesson_03.utils.SpringContextUtil;

/**
 * @description:
 * @author: zhang hang
 * @date: 2024/1/6 11:16.
 * @version: 1.0
 */
public class MyOperatorContext {

    private IMyOperatorStrategy myOperatorStrategy;

    public void executeStrategy(String paramA) {
        myOperatorStrategy.myOperatorProcess(paramA);
    }

    public MyOperatorContext(Class<? extends IMyOperatorStrategy> clazz) {
        try {
            myOperatorStrategy = SpringContextUtil.getBean(clazz);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
